<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class="gradient 090909 484559 vertical full">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <title>SpasaAnalytics - Sistema Supervisório</title>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="icon" href="/favicon.ico" type="image/x-icon"/>
    <meta name="verify-v1" content="Y5vj2OiQqXigk3PuqZ3Lo75DyrIpnPrrV1+U6bBc2A8="/>
    <meta name="y_key" content="8b599710ad81f61e"/>
    <meta name="author" content="SampCode.com"/>
    <meta name="DC.title" content="SampCode.com"/>
    <meta name="robots" content="ALL"/>
    <meta name="distribution" content="Global"/>
    <meta name="rating" content="General"/>
    <meta name="doc-class" content="Completed"/>
    <meta name="description" content="Um simples supervisor..."/>
    <meta http-equiv="Refresh" content="<%= @tempo_paineis %>"/>
    <%= stylesheet_link_tag "paineis" %>
    <%= javascript_include_tag :defaults %>

    <!-- <%= javascript_include_tag 'gradient.js' %>-->

    <%= javascript_include_tag 'shadowbox-prototype' %>
    <%= javascript_include_tag 'shadowbox' %>
    <%= javascript_include_tag 'shadowbox-pt-BR' %>

    <!--<%= javascript_include_tag "shadowbox-base" %> -->
    <script type="text/javascript">
        Shadowbox.loadSkin('classic', '/sandbox/skin');
                Shadowbox.loadLanguage('en', '/sandbox/lang');
                Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], '/sandbox/player');

                function comercial(){
                        extenssao = document.getElementById('extenssao');
                        url_conteudo = document.getElementById('url_conteudo');
                        if (extenssao != null && extenssao.value != "" &&
                                url_conteudo != null && url_conteudo.value != ""){
                                Shadowbox.open({
                                        player: extenssao.value,
                                        content: '/images/comercial/' + url_conteudo.value
                                        });
                                }
                        }

                window.onload = function(){
                        setInterval(showTimer,1000);

                        var options = {
                                onFinish:function() {
                                        tempo_comercial_off = document.getElementById('tempo_comercial_off');
                                        if (tempo_comercial_off != null && tempo_comercial_off.value != ""){
                                                var tempo = new Number(tempo_comercial_off.value);
                                                sleep(tempo);
                                                Shadowbox.close();
                                                }
                                        }
                                };
                        Shadowbox.init(options);
                        exibe = document.getElementById('exibe_comerical');
                        if (exibe != null && exibe.value == "true"){
                                tempo_comercial_on = document.getElementById('tempo_comercial_on');
                                if (tempo_comercial_on != null && tempo_comercial_on.value != ""){
                                        var tempo = new Number(tempo_comercial_on.value);
                                        setInterval(comercial,eval(tempo + tempo));
                                        }
                                }
                        };

                function sleep(milliseconds) {
                        var start = new Date().getTime();
                        for (var i = 0; i < 1e7; i++) {
                                if ((new Date().getTime() - start) > milliseconds){
                                        break;
                                        }
                                }
                        }


                function showTimer() {
                        var time=new Date();
                        var hour=time.getHours();
                        var minute=time.getMinutes();
                        var second=time.getSeconds();
                        if(hour<10)   hour  ="0"+hour;
                        if(minute<10) minute="0"+minute;
                        if(second<10) second="0"+second;
                        var st=hour+":"+minute+":"+second;
                        document.getElementById("timer").innerHTML=st;
                        }

                function hidden()
                        {document.body.style.overflow='hidden';}
                function unhidden()
                        {document.body.style.overflow='';}

    </script>
</head>
<body id='inicio'>
<%= hidden_field_tag 'url_conteudo', @url_conteudo %>
<%= hidden_field_tag 'exibe_comerical', @exibe_comerical %>
<%= hidden_field_tag 'tempo_comercial_on', @tempo_comercial_on %>
<%= hidden_field_tag 'tempo_comercial_off', @tempo_comercial_off %>
<%= hidden_field_tag 'extenssao', @extenssao %>

<div id='container'>
    <div id="banner">
        <div id="header">
            <span id="spinner" style="display: none"><img src='/images/indicator_arrows.gif'></span>

            <div class='clock'>
                <span id="timer">Relógio</span>
            </div>
        </div>
    </div>
    <div id="content">
        <%= yield %>
    </div>
    <%= periodically_call_remote(:url => {:action => 'footer'}, :frequency => @tempo_msg.to_i, :update => 'footer') %>
    <div id="footer">
    </div>
</div>
</body>
</html>
